package cn.how2j.trend.controller;

import cn.how2j.trend.pojo.Index;
import cn.how2j.trend.service.IndexService;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class IndexController {

    @Resource
    IndexService indexService;

    @GetMapping("/freshCodes")
    public List<Index> fresh() throws Exception{
        return indexService.fresh();
    }

    @GetMapping("/getCodes")
    public List<Index> get() throws Exception{
        return indexService.fetch_indexes_from_third_part();
    }
    @GetMapping("/removeCodes")
    public String remove() throws Exception{
         indexService.remove();
         return "remove successful";
    }
}
